<template>
    <section>
        <div v-show="vMaster">
            <sy-baselist
                    fixOperate
                    hideAdd
                    title="项目待跟进提醒"
                    editVue="./customer/ProjectTrace_Edit.vue"
                    :filters="filters"
                    @row-class-name="tableRowClassName"
                    listUrl="server/customer/ProjectTrace.ashx?cmd=GetMemoList"
                    deleteUrl="server/customer/ProjectTrace.ashx?cmd=Delete"
            >
                <el-table-column prop="CustomerName" header-align="center" label="客户名称" width="200" sortable>
                    <template scope="scope">
                        <a href="javascript:;" @click="viewCustomer(scope.row)">{{ scope.row.CustomerName }}</a>
                    </template>
                </el-table-column>
                <el-table-column prop="FLinkMan"  header-align="center" label="客方联系人"  width="110" >
                </el-table-column>
                <el-table-column prop="FLinkPhone"  header-align="center" label="客方联系电话"  width="130" >
                </el-table-column>
                <el-table-column prop="ProjectName"  header-align="center" label="项目名称"  width="200" sortable>
                </el-table-column>
                <el-table-column prop="FCreateDate"  header-align="center" label="已跟进时间" :formatter="formatDate" width="130" sortable>
                </el-table-column>
                <el-table-column prop="FToDate"  header-align="center" label="再跟进时间" :formatter="formatDate" width="130" sortable>
                </el-table-column>
                <el-table-column prop="FContent"  header-align="center" label="跟进内容" width="500" >
                </el-table-column>
                <el-table-column prop="FTalkTime" label="通话时长(分钟)"  width="150" >
                </el-table-column>
                <el-table-column prop="FRealName"  header-align="center" label="跟进人"  width="160" >
                </el-table-column>
            </sy-baselist>
        </div>
        <div v-show="vCustomer">
            <el-button type="success" size="small" icon="caret-left"
                       style="margin: 10px 0 0 10px" @click="back()">返回待跟进提醒列表</el-button>
            <CustomerOne ref="customerOne"></CustomerOne>
        </div>
    </section>
</template>

<script>
    import util from '../../common/util'
    import mixin from '../../common/mixin'
    import CustomerOne from "./Customer_One.vue"
    export default {
        mixins: [mixin],
        components:{
            CustomerOne:CustomerOne
        },
        data(){
            return {
                vMaster:true,
                vCustomer:false,
                filters: [{type: "string",name:"Customer.FName",text:"客户名称"},
                          {type: "string",name:"FContent",text:"跟进内容", value: ""},
                          {type: "date",name:"FToDate",text:"再跟进时间", value: null},
                          {type: "select",name:"FUserID",text:"跟进人", data:"server/system/User.ashx?cmd=GetUserOptions"}
                ]
            }
        },
        methods:{
            viewCustomer(row){
                //this.$router.push({path: '/Customer',query: {custID: row.FCustID }});
                this.vMaster = false
                this.vCustomer = true
                this.$refs.customerOne._initByID(row.FCustID)
            },
            tableRowClassName(row, index,r) {
                let now = new Date()
                if(row.FToDate && row.FToDate<now){
                    r.className = 'memo-row';
                }else {
                    r.className = '';
                }
            },
            back(){
                this.vMaster = true
                this.vCustomer = false
            }
        }
    }
</script>


<style>
    .el-table .memo-row {
        background: #ffc994;
    }
</style>